<!--
 * createor: zc
 * email: zc8023zs@163.com
 * create_time: 2020/3/14 13:46:24
 *-->
<template>
  <el-container>
    <el-header>
      用户优惠券详情
    </el-header>
    <el-main>
      <el-form label-width="200px" :inline="true" style="padding:5% 5% 0 5%">
        <el-form-item label="标识id：">
          <span>{{formData.user_coupon}}</span>
        </el-form-item>
        <el-form-item label="运营中心id：">
          <span>{{formData.oc_id}}</span>
        </el-form-item>
        <el-form-item label="店铺/门店id：">
          <span>{{formData.shop_id}}</span>
        </el-form-item>
        <el-form-item label="红包金额：">
          <span>{{formData.full_money}}</span>
        </el-form-item>
        <el-form-item label="红包类型：">
          <span>{{formData.coupon_type}}</span>
        </el-form-item>
        <el-form-item label="满减条件：">
          <span>{{formData.off_money}}</span>
        </el-form-item>
        <el-form-item label="时间类型：">
          <span>{{formData.time_type}}</span>
        </el-form-item>
        <el-form-item label="开始时间：">
          <span>{{formData.start_time}}</span>
        </el-form-item>
        <el-form-item label="结束时间：">
          <span>{{formData.end_time}}</span>
        </el-form-item>
        <el-form-item label="有效天数：">
          <span>{{formData.duration}}</span>
        </el-form-item>
        <el-form-item label="创建时间：">
          <span>{{formData.create_time}}</span>
        </el-form-item>
        <el-form-item label="红包数量：">
          <span>{{formData.all_num}}</span>
        </el-form-item>
        <el-form-item label="已领数量：">
          <span>{{formData.off_num}}</span>
        </el-form-item>
        <el-form-item label="每人限领：">
          <span>{{formData.one_num}}</span>
        </el-form-item>
        <el-form-item label="活动公用：">
          <span>{{formData.use_union}}</span>
        </el-form-item>
        <el-form-item label="是否可用：">
          <span>{{formData.status}}</span>
        </el-form-item>
        <el-form-item label="使用时间：">
          <span>{{formData.use_time}}</span>
        </el-form-item>
        <el-form-item label="过期时间：">
          <span>{{formData.expired_time}}</span>
        </el-form-item>
        <el-form-item label="数据版本字段：">
          <span>{{formData.version_id}}</span>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>
<style scoped>
body .app-container .el-container,
body .app-container .el-header,
body .app-container .el-main,
body .el-container,
body .el-header,
body .el-main {
  padding: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
</style>
<script>
import { Loading } from "element-ui";
import {
  qr_user_couponInfo
} from '@/api/project/wmyw/project_wmyw_qr_user_coupon'
export default {
  name: "a_wmywa_qr_user_coupon_info",
  data() {
    return {
      infoLoading: false,
      formData:{
        user_coupon: 0, 
        oc_id: 0, 
        shop_id: 0, 
        full_money: 0.0, 
        coupon_type: 0, 
        off_money: 0.0, 
        time_type: 0, 
        start_time: '2020/8/11 15:00:36', 
        end_time: '2020/8/11 15:00:36', 
        duration: 0, 
        create_time: '2020/8/11 15:00:36', 
        all_num: 0, 
        off_num: 0, 
        one_num: 0, 
        use_union: 0, 
        status: 0, 
        use_time: '2020/8/11 15:00:36', 
        expired_time: '2020/8/11 15:00:36', 
        version_id: 0, 
      }
    };
  },
  activated() {
    var result = location.search.match(new RegExp("[\?\&]id=([^\&]+)", "i"));
    if(result != null || result.length > 0){
      this.onInfo(result[1]);
    }
  },
  methods: {
    onInfo(id){
      this.infoLoading=true;
      qr_user_couponInfo({id:id}).then(r=>{
        this.formData.user_coupon = r.dataSingle.user_coupon, 
        this.formData.oc_id = r.dataSingle.oc_id, 
        this.formData.shop_id = r.dataSingle.shop_id, 
        this.formData.full_money = r.dataSingle.full_money, 
        this.formData.coupon_type = r.dataSingle.coupon_type, 
        this.formData.off_money = r.dataSingle.off_money, 
        this.formData.time_type = r.dataSingle.time_type, 
        this.formData.start_time = r.dataSingle.start_time, 
        this.formData.end_time = r.dataSingle.end_time, 
        this.formData.duration = r.dataSingle.duration, 
        this.formData.create_time = r.dataSingle.create_time, 
        this.formData.all_num = r.dataSingle.all_num, 
        this.formData.off_num = r.dataSingle.off_num, 
        this.formData.one_num = r.dataSingle.one_num, 
        this.formData.use_union = r.dataSingle.use_union, 
        this.formData.status = r.dataSingle.status, 
        this.formData.use_time = r.dataSingle.use_time, 
        this.formData.expired_time = r.dataSingle.expired_time, 
        this.formData.version_id = r.dataSingle.version_id, 
        this.infoLoading=false;
      }).catch(()=>{
        this.infoLoading=false;
      });
    }
  }
}
</script>
